package com.akaovi.exp;

import javax.xml.crypto.Data;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;


/**
 * @author akaovi
 * @version 1.0
 * @description
 * @date 2022/11/14 14:21
 * @since 2022/11/14 14:21
 */
public class One {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date date1;
        Date date2;
        while (true) {
            try {
                System.out.print("请输入一个合法日期: ");
                date1 = dateFormat.parse(scan.next());
                break;
            } catch (ParseException e) {
                System.out.print("请重新输入: ");
            }
        }
        while (true) {
            try {
                System.out.print("请输入一个合法日期: ");
                date2 = dateFormat.parse(scan.next());
                break;
            } catch (ParseException e) {
                System.out.print("请重新输入: ");
            }
        }
    }
}
